<!DOCTYPE html>
<html lang="en">
<head>
    
    <meta charset="utf-8">
    <title>Global - Documentation</title>
    
    
    
        <meta name="keywords" content="webpack ES6 " />
        <meta name="keyword" content="webpack ES6 " />
    
    
    
    <meta property="og:title" content="test2"/>
    <meta property="og:type" content="website"/>
    <meta property="og:image" content=""/>
    
    <meta property="og:url" content=""/>
    
    <script src="scripts/prettify/prettify.js"></script>
    <script src="scripts/prettify/lang-css.js"></script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
    <script src="scripts/nav.js" defer></script>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>

<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
  <div class="navicon"></div>
</label>

<label for="nav-trigger" class="overlay"></label>

<nav class="wrap">
    
    <input type="text" id="nav-search" placeholder="Search" />
    
    <h2><a href="index.html">Home</a></h2><h2><a href="https://gitee.com/shanliangdeYWJ" target="_blank" class="menu-item" id="website_link" >码云shanliangdeYWJ</a></h2><h3>Tutorials</h3><ul><li><a href="tutorial-Overview.html">Overview</a></li></ul><h3>Global</h3><ul><li><a href="global.html#cookie2json">cookie2json</a></li><li><a href="global.html#delCookie">delCookie</a></li><li><a href="global.html#getCookie">getCookie</a></li><li><a href="global.html#getPath">getPath</a></li><li><a href="global.html#setCookie">setCookie</a></li></ul>
</nav>

<div id="main">
    
    <h1 class="page-title">Global</h1>
    

    




<section>

<header>
    
        <h2>
        
        </h2>
        
    
</header>

<article>
    
        <div class="container-overview">
        
            

<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>




            

            
        
        </div>
    

    

    

    
    
    

     

    

    

    
        <h3 class="subsection-title">Methods</h3>

        
            

    

    <h4 class="name" id="cookie2json"><span class="type-signature"></span>cookie2json<span class="signature">(cookie_name)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="cookie.js.html">cookie.js</a>, <a href="cookie.js.html#line6">line 6</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description usertext">
    <p>cookie 转化 json 格式
如果有传入的cookie name转化传入的cookie</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>cookie_name</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>需要转化成json的cookie的字符串</p></td>
        </tr>

    
    </tbody>
</table>



















        
            

    

    <h4 class="name" id="delCookie"><span class="type-signature"></span>delCookie<span class="signature">(name, domain, path)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="cookie.js.html">cookie.js</a>, <a href="cookie.js.html#line65">line 65</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description usertext">
    <p>用例：</p>
<pre class="prettyprint source lang-js"><code>delCookie('YWJ1',document.domain,'/')
</code></pre>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>name</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>需要删除的 cookie 的名字</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>domain</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>需要删除的 cookie 的所在域名 默认当前浏览器域名，可以传递空字符串占位</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>path</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>需要删除的 cookie 的路径 默认当前浏览器根据经，需要删除其他路径请自行传入</p></td>
        </tr>

    
    </tbody>
</table>



















        
            

    

    <h4 class="name" id="getCookie"><span class="type-signature"></span>getCookie<span class="signature">(name)</span><span class="type-signature"> &rarr; {Array.&lt;string>|Array.&lt;any>}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="cookie.js.html">cookie.js</a>, <a href="cookie.js.html#line45">line 45</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description usertext">
    <p>根据 cookie 名字获取 cookie</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>name</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>cookie名字</p></td>
        </tr>

    
    </tbody>
</table>
















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>找到就返回 cookie 没有就返回 空字符串</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Array.&lt;string></span>
|

<span class="param-type">Array.&lt;any></span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="getPath"><span class="type-signature"></span>getPath<span class="signature">(str)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="cookie.js.html">cookie.js</a>, <a href="cookie.js.html#line28">line 28</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description usertext">
    <ol>
<li><a href="http://tool.chinaz.com/regex/">正则站长工具</a></li>
<li><a href="https://www.cnblogs.com/DreamRecorder/p/8966642.html">实用正则表达式匹配和替换</a></li>
<li><a href="https://www.cnblogs.com/pengzp97/p/10297594.html">slice 数组教程</a>
获取 cookie path 属性值的 方法</li>
</ol>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>str</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>url path 部分 默认可以传递 window.location.pathname</p></td>
        </tr>

    
    </tbody>
</table>



















        
            

    

    <h4 class="name" id="setCookie"><span class="type-signature"></span>setCookie<span class="signature">(c_name, value, enpiredays)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="cookie.js.html">cookie.js</a>, <a href="cookie.js.html#line98">line 98</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description usertext">
    <p>定义创建一个cookie的函数
在客户端自己创建一个cookie
cookie 分成: 名字, 值, 过期时间, 三部分</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>c_name</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>cookie 名字</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>value</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>cookie 值</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>enpiredays</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            

            

            <td class="description last"><p>cookie 过期时间</p>
<p>1.实际上是c_name=value 但是为了防止值存在URL里不允许出现的字符，所以用escape（）方法，
即将String进行编码
2.第二行是三目运算（条件）？真值：假值 后面的；是与前面做拼接
3.toGMTString（）转化为格林尼治的世界格式</p>
<pre class="prettyprint source lang-js"><code>setCookie('YWJ4', '24', 1, '')
</code></pre></td>
        </tr>

    
    </tbody>
</table>



















        
    

    

    
</article>

</section>




    
    
</div>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Nov 22 2020 05:03:22 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>

<script src="scripts/search.js" defer></script>


<script src="scripts/collapse.js" defer></script>


    <link type="text/css" rel="stylesheet" href="./shanliangdeYWJ.css">
    
</body>
</html>